package ru.evga.inse.server.gwt.user.client.menu;

import ru.evga.inse.server.gwt.user.client.IUserAppFactory;
import ru.evga.inse.server.gwt.user.client.menu.MainMenuView.Presenter;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;


public class MainMenuActivity
    extends AbstractActivity
    implements Presenter
{
    
    private IUserAppFactory m_factory;
    
    
    public MainMenuActivity(IUserAppFactory factory)
    {
        m_factory = factory;
    }
    
    public void start(AcceptsOneWidget panel, EventBus eventBus)
    {
        MainMenuView menuView = m_factory.getMainMenuView();
        menuView.setPresenter(this);
        panel.setWidget(menuView.asWidget());
    }

    public void goToMain()
    {
        m_factory.getPlaceController().goTo(MenuPlaceUtil.getBuilderForMenu(MenuItem.GENERAL).build());
    }

    public void goToRealty()
    {
        m_factory.getPlaceController().goTo(MenuPlaceUtil.getBuilderForMenu(MenuItem.REALTY).build());
    }

    public void goToForum()
    {
        m_factory.getPlaceController().goTo(MenuPlaceUtil.getBuilderForMenu(MenuItem.FORUM).build());
    }

    public void goToAdmin()
    {
        m_factory.getPlaceController().goTo(MenuPlaceUtil.getBuilderForMenu(MenuItem.ADMIN).build());
    }
}
